package com.example.myapplication;

import android.app.Application;
import android.util.Log;

import com.example.myapplication.util.OrderedProperties;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Set;

public class MyApplication extends Application {

    private OrderedProperties props = new OrderedProperties();

    public OrderedProperties getProps() {
        return props;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        //获取产品配置
        try {
            InputStream inputStream = getAssets().open("productconfig.properties");
            //中文乱码
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
            props.load(bufferedReader);
            Set<String> strings = props.stringPropertyNames();
            for (String string : strings) {
                Log.d("zoubo", string + ":" + props.getProperty(string));
            }
        } catch (IOException e) {
            Log.e("zoubo", "productconfig open fail");
        }
    }
}
